/**
 * 
 */
package br.ifpb.edu.uml.elements;

import java.util.ArrayList;

/**
 * @author iponts
 *
 */
public class Class {
	
	 private String className;
	 // true for class, and false for interface
	 private boolean type;
	 private ArrayList<Attribute> attributes = new ArrayList<Attribute>( );
	 private ArrayList<Methods> methods = new ArrayList<Methods>( );
	 private ArrayList<Relationship> relationships = new ArrayList<Relationship>( );
	 
	 public Class( ) {
		 setType( true );
	 }
	 
	 public Class( String nome, boolean tip ) {
		 setClassName( nome );
		 setType( tip );
	 }
	 
	/**
	 * >>> Metodos GET
	 */
	public String getClassName( ) {
		return className;
	}
	
	public int sizeAttributes( ){
		return attributes.size();
	}
	
	public Attribute getAttribute( int index ) {
		return attributes.get( index );
	}
	
	public Relationship getRelationships( int index ) {
		return relationships.get(index);
	}
	
	public int sizeRelationships( ){
		return relationships.size();
	}
	
	public int sizeMethods( ){
		return methods.size();
	}
	
	public Methods getMethods( int index ) {
		return methods.get(index);
	}
	
	public boolean getType( ) {
		return type;
	}
	
	/**
	 * >>> SET Methods
	 */
	
	public void setAttribute( String acessModified, String type, String name ) {
		Attribute a = new Attribute( acessModified, type, name );
		if( a != null ) attributes.add( a );
		
	}
	
	public void setAttribute( Attribute a ) {
		attributes.add( a );
	}
	
	public void setMethod( Methods m ) {
		methods.add( m );
	}
	
	public void setRelatioships( Relationship r ) {
		relationships.add( r );
	}
	
	public void removeMethod( ) {
		methods.remove( ( methods.size( ) - 1 ) );
	}
	
	public void removeAttribute( ) {
		attributes.remove( ( attributes.size( ) - 1 ) );
	}
	
	public void removeRelationships( ) {
		relationships.remove( ( relationships.size( ) - 1 ) );
	}
	
	public void setRelationship( String motherClass, String relationType, String multiplicity ) {
		Relationship r = new Relationship( motherClass, relationType, multiplicity );
		if( r != null ) relationships.add( r );
	}
	
	public void setRelationship( String motherClass, String relationType ) {
		Relationship r = new Relationship( motherClass, relationType );
		if( r != null ) relationships.add( r );
	}
	
	public void setType( boolean type ) {
		this.type = type;
	}
	
	public void setClassName( String className ) {
		this.className = className;
	}
	
	public int numberAttributes( ) {
		return attributes.size();
	}
	
	public int numberMethods( ) {
		return methods.size();
	}
	
	public int numberRelationships( ) {
		return relationships.size();
	}
	
}
